home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 1.9 KB | 69 lines | [TEXT/ttxt] |
- --<<<-
- -- Filename: ANIMSHP2.SX
-
- -- Other Files Required: (none)
-
- -- Purpose: To demonstrate how animation works using
- -- TargetListAction to change the targets in the list
-
- -- Specialized Classes: (none)
-
- -- Instructions to User: Load this file; it displays a window,
- -- which is initially empty, then displays a 2D shape that
- -- changes from a cirle to a rounded rectangle to a rectangle.
- -- To start again, type: "goToBegin alp"
-
- -- Author: Douglas Kramer
-
- ------------------------------------------------------------------------
-
- -- Create a window
- global myWindow := new Window boundary:(new Rect x2:200 y2:200)
- myWindow.y := 40
- show myWindow
-
- -- Create the ActionList and ActionListPlayer
- global al := new ActionList
- global alp := new ActionListPlayer actionList:al scale:30 targetCount:24
- alp.authorData := myWindow
-
- -- Script to create a blue circle
- function createCircle action target player ->
- (
- local myShape := new TwoDShape target:(new Oval x2:80 y2:80)
- myShape.fill := new Brush color:blueColor
- myShape.x := 60
- myShape.y := 60
- append player.authorData myShape
- myShape
- )
-
- function emptyOutTargets action target player ->
- (
- emptyOut player.authorData
- emptyOut player.targets
- )
-
- -- Set action to create and add the circle to the targets
- global addCircleToTargets := new TargetListAction targetNum:1 time:1 \
- script:createCircle rewindScript:emptyOutTargets
-
- -- Set an action to change its shape
- global makeRoundRect := new ShapeAction targetNum:1 time:30 \
- shape:(new RoundRect x2:80 y2:80 rx:30 ry:30)
-
- -- Set another action to change its shape
- global makeRect := new ShapeAction targetNum:1 time:60 \
- shape:(new Rect x2:80 y2:80)
-
- -- Append actions to the ActionList
- append al addCircleToTargets
- append al makeRoundRect
- append al makeRect
-
- -- Play the ActionListPlayer
- play alp
-
- -- To play again, type: goToBegin alp
-
-